import React from 'react';
import {
    Button, ToastAndroid,
    View,
} from 'react-native';
import BottomPop from "../widget/modal/BottomPop";
import PageImageItem from "./PageImageItem";

/** 控件列表 */
export default class PageCtrl extends React.Component {

    mPopArg:Array = ['1', '2', '33'];

    render() {
        return (
            <View>
                <View style={{height: 15, backgroundColor: 'white', opacity: 0.5}}/>
                <Button
                    title="进度条"
                    onPress={() => this.props.navigation.navigate('ProgressBar')}/>

                <View style={{height: 15, backgroundColor: 'white', opacity: 0.5}}/>
                <Button
                    title="底部弹出"
                    onPress={() => this._showPop()}/>

                <View style={{height: 15, backgroundColor: 'white', opacity: 0.5}}/>
                <Button
                    title="按钮"
                    onPress={() => this.props.navigation.navigate('PageButton')}/>

                <View style={{height: 15, backgroundColor: 'white', opacity: 0.5}}/>
                <Button
                    title="数据行"
                    onPress={() => this.props.navigation.navigate('PageLineItem')}/>

                <View style={{height: 15, backgroundColor: 'white', opacity: 0.5}}/>
                <Button
                    title="提示框"
                    onPress={() => this.props.navigation.navigate('PageAlertItem')}/>

                <View style={{height: 15, backgroundColor: 'white', opacity: 0.5}}/>
                <Button
                    title="图片"
                    onPress={() => this.props.navigation.navigate('PageImageItem')}/>

                <BottomPop ref="pop" onClick={(index:number)=>this._onClick(index)} />
            </View>
        );
    }

    /** 显示 */
    _showPop() {
        this.refs.pop.setDatasAndShow("这是一个Title", this.mPopArg);
    }

    /** 点击回调 */
    _onClick(index:number){
        ToastAndroid.show(this.mPopArg[index], ToastAndroid.SHORT);
    }
}


